<?php
namespace BP\En;
require_once("java/util/Enumeration.php");
require_once("BP/Difference/ContextHolderUtils.php");
require_once("BP/Web/WebUser.php");
class AttrOfSearch {
	public $HisAttr;	// Attr
	protected $_IsHidden;	// boolean
	protected $_SymbolEnable;	// boolean
	protected $_Lab;	// String
	protected $_DefaultVal;	// String
	protected $_defaultSymbol;	// String
	protected $_RefAttr;	// String
	protected $_Key;	// String
	protected $_TBWidth;	// int
	private function __init() { // default class members
		$this->HisAttr = NULL;
		$this->_IsHidden =  FALSE ;
		$this->_SymbolEnable =  TRUE ;
		$this->_Lab = "";
		$this->_DefaultVal = "";
		$this->_defaultSymbol = "=";
		$this->_RefAttr = "";
		$this->_Key = "";
		$this->_TBWidth = 10;
	}
	public function getIsHidden () 
	{
		return $this->_IsHidden;
	}
	public function setIsHidden ($value) // [boolean value]
	{
		$this->_IsHidden = $value;
	}
	public function getSymbolEnable () 
	{
		return $this->_SymbolEnable;
	}
	public function setSymbolEnable ($value) // [boolean value]
	{
		$this->_SymbolEnable = $value;
	}
	public function getLab () 
	{
		return $this->_Lab;
	}
	public function setLab ($value) // [String value]
	{
		$this->_Lab = $value;
	}
	public function getDefaultVal () 
	{
		return $this->_DefaultVal;
	}
	public function setDefaultVal ($value) // [String value]
	{
		$this->_DefaultVal = $value;
	}
	public function getDefaultValRun () 
	{
		if (($this->_DefaultVal . NULL))
		{
			return NULL;
		}
		if ($this->_DefaultVal->contains("@"))
		{
			if ($this->_DefaultVal->contains("@WebUser.getNo()"))
			{
				return $this->_DefaultVal->replace("@WebUser.getNo()", $WebUser->getNo());
			}
			if ($this->_DefaultVal->contains("@WebUser.getName()"))
			{
				return $this->_DefaultVal->replace("@WebUser.getName()", $WebUser->getName());
			}
			if ($this->_DefaultVal->contains("@WebUser.getFK_Dept()"))
			{
				return $this->_DefaultVal->replace("@WebUser.getFK_Dept()", $WebUser->getFK_Dept());
			}
			if ($this->_DefaultVal->contains("@WebUser.DeptParentNo"))
			{
				return $this->_DefaultVal->replace("@WebUser.DeptParentNo", $WebUser->getDeptParentNo());
			}
			if ($this->_DefaultVal->contains("@WebUser.getFK_DeptName"))
			{
				return $this->_DefaultVal->replace("@WebUser.getFK_DeptName", $WebUser->getFK_DeptName());
			}
			if ($this->_DefaultVal->contains("@WebUser.getFK_DeptNameOfFull"))
			{
				return $this->_DefaultVal->replace("@WebUser.getFK_DeptNameOfFull", $WebUser->getFK_DeptNameOfFull());
			}
			$enu = $ContextHolderUtils->getRequest()->getParameterNames();
			while ($enu->hasMoreElements()) 
			{
				$key = $enu->nextElement();
				if ($this->_DefaultVal->contains($key))
					return $this->_DefaultVal->replace(("@" . $key), $ContextHolderUtils->getRequest()->getParameter($key));
			}
		}
		return $this->_DefaultVal;
	}
	public function getDefaultSymbol () 
	{
		return $this->_defaultSymbol;
	}
	public function setDefaultSymbol ($value) // [String value]
	{
		$this->_defaultSymbol = $value;
	}
	public function getRefAttrKey () 
	{
		return $this->_RefAttr;
	}
	public function setRefAttrKey ($value) // [String value]
	{
		$this->_RefAttr = $value;
	}
	public function getKey () 
	{
		return $this->_Key;
	}
	public function setKey ($value) // [String value]
	{
		$this->_Key = $value;
	}
	public function getTBWidth () 
	{
		return $this->_TBWidth;
	}
	public function setTBWidth ($value) // [int value]
	{
		$this->_TBWidth = $value;
	}
	public static function constructor__String_String_String_String_String_I_b ($key, $lab, $refAttr, $DefaultSymbol, $defaultValue, $tbwidth, $isHidden) // [String key, String lab, String refAttr, String DefaultSymbol, String defaultValue, int tbwidth, boolean isHidden]
	{
		$me = new self();
		$me->__init();
		$me->setKey($key);
		$me->setLab($lab);
		$me->setRefAttrKey($refAttr);
		$me->setDefaultSymbol($DefaultSymbol);
		$me->setDefaultVal($defaultValue);
		$me->setTBWidth($tbwidth);
		$me->setIsHidden($isHidden);
		return $me;
	}
	public static function constructor__Attr_String_String_I_b ($attr, $DefaultSymbol, $defaultValue, $tbwidth, $isHidden) // [Attr attr, String DefaultSymbol, String defaultValue, int tbwidth, boolean isHidden]
	{
		$me = new self();
		$me->__init();
		$me->HisAttr = $attr;
		$me->setKey($attr->getKey());
		$me->setLab($attr->getDesc());
		$me->setRefAttrKey($attr->getKey());
		$me->setDefaultSymbol($DefaultSymbol);
		$me->setDefaultVal($defaultValue);
		$me->setTBWidth($tbwidth);
		$me->setIsHidden($isHidden);
		return $me;
	}
}
?>
